package com.k2.whereareyou.engine;

import com.k2.whereareyou.interfaces.IConstants;
import android.content.Context;
import android.view.Gravity;
import android.widget.Toast;

public class Engine implements IConstants{
	

	public static byte setLanguage(Context context) {
		if (context.getResources().getConfiguration().locale.getLanguage().equalsIgnoreCase("ru")){
			return 1;
		}
		else
			return 0;
	}
	
	public static String validation(String email, String pass, byte language){
		String rezult = " ";
		if (email.equals(""))
			rezult += TEXT_MESSAGES[language][0] + "\n" ;
		else {
			if (!email.matches("[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+") )
				rezult += TEXT_MESSAGES[language][2] + "\n" ;
		}
		if (pass.equals(""))
			rezult += TEXT_MESSAGES[language][1] + "\n" ;
		return rezult.substring(0, rezult.length()-1);
	}
	
	public static void toast(Context context, String message){
        Toast toast = Toast.makeText(context,message, Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER, 0, 0);
        toast.show();
	}
	
	
}
